/* (C) C.D.F. Miller, Heriot-Watt University, March 1984
 *
 *	Permission is hereby given to reproduce or modify this
 *	software freely, provided that this notice be retained,
 *	and that no use be made of the software for commercial
 *	purposes without the express written permission of the
 *	author.
 */

#include        <string.h>
#include	<lbl.h>
#include        "build.h"
#include        "find.h"

extern LIST_HEAD(, Type) typehead;

Type   *
findtype(char *name, int create)
{
	rg Type *tp;

	LIST_FOREACH(tp, &typehead, link)
	if (strcmp(name, tp->t_name) == 0)
		return tp;
	if (create)
		return addtype(name);
	return NULL;
}

Label  *
typeFindlabel(Type *tp, char *name)
{
	rg Label *lp;

	if (tp == NULL)
		return NULL;
	LIST_FOREACH(lp, &(tp->labelhead), link)
	if (strcmp(name, lp->l_name) == 0)
		return lp;
	return NULL;
}
